package config;

/**
 * @Description:
 * @Author one world
 * @Date 2020/9/21 0021 23:05
 */
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id =
            "2016102700771103";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDdeA/XXmnyS57n+lttHb5TpWjAprs5BR/iFKIqvnrZGsmu9Zaphc7+pOgM4SYX+5wds6v4x5RPO7uhRSzjf28XV3RBo4msDFLVEYNhwuOVuoJoYE129mf3ML7s6cvLV32Qhy63szACeXqUwykQqk0agt70un3RVIhYXPpi4EGjDBZfpsFzvSgqqzIPrQF1vucysPuvZdDbrfrSZu5rq81xvDetqpTA8vp6hhcFTOEoV8wYZFzGIakT8X7hpt6blRBKDM3qp8Qdetzh+NivuBmmVY1a5xXWkcPJ0rXrVLClMI2wVjwqPSk0hg/2eA1f5rMEJ7HI7mfX7qZOThNFD5I7AgMBAAECggEAJzytOc/tX1MMfTb62bMqVDF7BJ7Fjs2cn3ZeYMpMg4hecRPrtG8ThEP9JMMC977JIu4BKttZKEyB6omR8WBTc0Q4QaTSsFuilUM8DqbzoURg9FMThl8TflTxjpHBXG5Mvb1lhoBFojqZgB+vd9dkP60uCRe9UMf0PAuFBN2MY3FdUafalcEslJHfYMB/eFA97z3Yk0nbAZQvDxK5qat0BzWp34Szq3rOB75SSkXXfo0HFLD/Gr8EmvSn4DoA8wYIh702yEe2rka57Nvl2aJ/3A07C2u26gBHrMNi2LkJqjQj5OteHt65uHAubawEXKhYjtwKLfoRtvWMUcQUw1i+SQKBgQD5wQIrr0PVhrxbEWj3PYyYDGijMpTf8xlfATKKYX7tAMwM5DfqnH7noIsP27vrxcuiBZlsJPbsNcDPLRm20pGzOmwcHmkndpeDiTwYb945wIRUzY9UethVrpASx/5ImmpWh1JgP06IinUVWOZ0v5LCAVQJCEiPd/aiSE2mQrovrwKBgQDjAfcxnJ3IbT5pk7XTNrnEWKrQ+iwD3Dq6ChfpF1A59rXkbXNjV5KIZk8HxECkgQdJ8GVkH3pB4mrrQno2Vhla8w8fKteEHNYSVsdoFuwTTTh97El7msFlh2H0QBzf3jKJEUN3gW+B7Pv9/fmeQXYnwHiT6rAgXHUWlLthtgk9NQKBgQCBm7HerbOMKcGxmNVaCOzfMwFSP7uWhHeUH/D0cygFIjbCMeT6sYACAARqlGNvNVQ5nqJBxuUFK9gFK6h+gcPuuNDFvtpfCmISdrNjExrF6axCvfI1qxJ9VHub44GId+nbQZp0LCY7IW8lRt9BkvE8EKhlj5DoMx8glFkHgPVSLQKBgQCXAFW4EJ/8FH7xp6nJJ5wGeZyWifMBVltSKSiiijl5dRylKBEbQcNdLADh/6+oPZPloR0wrqeab8wDViMJRdhz4T5r0wms/amAZW0bVjQO2sz7JlPy/owqxxVnbcZHO/yNpIgmVFkiKcuttmV22cCIzMToT7J8tEPGk4TZiEc5CQKBgEq5fGo8EdvHTqShF986opSc3SPoRhSXEUUgB/krRGF7eX7cdKBmPwEIJF337i0wkuGXSTDIuHOJy0C4+1xjAgt/xyrXY2jYxH+csH5EEEDcZuEMmGR2YYfsVkqQKvAkOSshyXI5tdcol2EGiPNrryq12CLeeZAn3hO9CI06bSOQ";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs1UHdfF9+IDmDYuZ9fuYjYhcepPGANRz1RI9y8MQzbc1se4/t/j3UB/V9SOi58W3n6kfaDcqXMvTRiyx7+J1YR9LM31AE+YOZhQflbwJTSvWvix3WRpxz6yeC16ClN33gmQm5jxvmINJAB/K15kUqTIiF2Bo1DsdDz2qPZyuWOI6vLVPeYlqqBHs+MvvEpeqIKhBbJokqCUtoOvYE4+KheDSjqSu6B+zDW7DZmhwrRrCBV5A9H1GxPgBGaA+HSK5jgqTCV7g0NCbQre9YtYYO+rIcRe8vnAo3dJNzkC12C4f8q6DxAcYjkncByLMcukn2X/dI7RyU2osGRoRZyNZxQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    public static String notify_url = "http://localhost/alipay/notify_url.jsp";
    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost/alipay";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}